<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<title></title>

	</head>

	<body>
		<button id="signIn">注册</button>
		<script type="text/javascript">
			document.addEventListener('plusready', function() {
				//console.log("所有plus api都应该在此事件发生后调用，否则会出现plus is undefined。"
				document.getElementById('signIn').onclick = function(){
					var xhr = new plus.net.XMLHttpRequest();
					xhr.onreadystatechange = function() {
						switch(xhr.readyState) {
							case 0:
								//							alert("xhr请求已初始化");
								break;
							case 1:
								//							alert("xhr请求已打开");
								break;
							case 2:
								//							alert("xhr请求已发送");
								break;
							case 3:
								//							alert("xhr请求已响应");
								break;
							case 4:
								if(xhr.status == 200) {
									alert("xhr请求成功：" + xhr.responseText);
								} else {
									alert("xhr请求失败：" + xhr.readyState);
								}
								break;
							default:
								break;
						}
					}
					xhr.open("POST", "http://192.168.10.64:8001/api/signIn");
					var data = {
						username: '763127',
						password: '123456',
						nickname: 'liyang1'
					};
					xhr.send(data);
				}
			});
		</script>
	</body>

</html>